isValidDate(date: Date
| BasicJewishDate
) ⇒ boolean
Returns whether a date is a Date object.
Param | Type |
---|
date | Date | BasicJewishDate |
example:
const basicJewishDate: BasicJewishDate = {
day: 13,
monthName: "Elul",
year: 5788,
};
isValidDate(basicJewishDate);
isValidDate(new Date());
isMeubar(year: number
) ⇒ boolean
Returns whether a hebrew year is meubar (leap year).
example:
isMeubar(5781);
isMeubar(5782);
getHebWeekdays() ⇒ string[]
Returns an array of week days in hebrew.
example:
getHebWeekdays();
getEngWeekdays() ⇒ string[]
Returns an array of week days in english.
example:
getEngWeekdays();
getWeekdays(isHebrew: boolean
) ⇒ string[]
Returns an array of week days corresponding with the isHebrew param.
example:
getWeekdays(true);
getWeekdays(false);
convertToHebrew(num: number
, [addGeresh: boolean
, addPunctuate: boolean
]) ⇒ string
Converts a numerical value to a string of Hebrew letters (gematriya).
Based on gematriya library:
Setting false as the value for the punctuate key will remove double and single quotation marks in the returned string. Setting geresh to false will use ASCII single/double quotes instead of Hebrew geresh/gershayim Unicode characters. (see example bellow)
Param | Type | Default |
---|
num | number | n/a |
addGeresh | boolean | true |
addPunctuate | boolean | true |
example:
convertToHebrew(5782);
convertToHebrew(5782, false);
convertToHebrew(5782, false, false);
getHebJewishMonthById(monthId: string
) ⇒ string
Takes a jewish month name in english and returns the name in hebrew.
example:
getHebJewishMonthById("Tishri");
getHebJewishMonths() ⇒ IdText[]
Returns an array of jewish months in hebrew.
example:
getHebJewishMonths();
getEngJewishMonths() ⇒ IdText[]
Returns an array of jewish months in english.
example:
getEngJewishMonths();
getJewishMonths(year: number
, [isHebrew?: boolean
]) ⇒ IdText[]
Returns an array of jewish months according to year (regular/leap) and language.
Param | Type | Default |
---|
year | number | n/a |
isHebrew | boolean | false |
example:
getJewishMonths(5781, true);
getJewishMonths(5782);
getJewishYears(year: number
) ⇒ number[]
Takes a number of a jewish year and returns array of 200 years around it.
example:
getJewishYears(5781);
getJewishYears(5781).length;
getPrevMonth(basicJewishMonthInfo: BasicJewishMonthInfo
) ⇒ BasicJewishMonthInfo
Takes a BasicJewishMonthInfo object and returns the equivalent of prev month.
Param | Type |
---|
basicJewishMonthInfo | BasicJewishMonthInfo |
example:
const tishriInfo: BasicJewishMonthInfo = {
isHebrew: false,
month: "Tishri",
year: 5782,
};
getPrevMonth(tishriInfo);
getNextMonth(basicJewishMonthInfo: BasicJewishMonthInfo
) ⇒ BasicJewishMonthInfo
Takes a BasicJewishMonthInfo object and returns the equivalent of next month.
Param | Type |
---|
basicJewishMonthInfo | BasicJewishMonthInfo |
example:
const elulInfo: BasicJewishMonthInfo = {
isHebrew: true,
month: "Elul",
year: 5781,
};
getNextMonth(elulInfo);
getGregDate(props: BasicJewishDate) ⇒ Date
Converts BasicJewishDate object to gregorian date.
Param | Type |
---|
props | BasicJewishDate |
example:
const basicJewishDate: BasicJewishDate = {
day: 13,
monthName: "Elul",
year: 5781,
};
getGregDate(basicJewishDate);
getJewishMonthInfo(date: Date) ⇒ JewishMonthInfo
Takes a gregorian date and returns BasicJewishMonthInfo object.
example:
getJewishMonthInfo(new Date(2022, 0, 27));
formatJewishDate(jewishDate: JewishDate
) ⇒ string
Takes a BasicJewishDate object and returns a string of the date in english.
Param | Type |
---|
jewishDate | JewishDate |
example:
const jewishDate: JewishDate = {
day: 13,
monthName: "Elul",
year: 5781,
month: 13,
};
formatJewishDate(jewishDate);
formatJewishDateHebrew(jewishDate: JewishDate
) ⇒ string
Takes a BasicJewishDate object and returns a string of the date in hebrew.
Param | Type |
---|
jewishDate | JewishDate |
example:
const jewishDate: JewishDate = {
day: 13,
monthName: "Elul",
year: 5781,
month: 13,
};
formatJewishDateHebrew(jewishDate);
getJewishDate(date: Date
) ⇒ JewishDate
Takes a gregorian date and returns a BasicJewishDate object.
example:
getJewishDate(new Date(2021, 7, 21));
IsJewishDatesEqual(jewishDate1: JewishDate
, jewishDate2: JewishDate
) ⇒ boolean
Compares jewish dates returning true if the dates match and false if not.
Param | Type |
---|
jewishDate1 | JewishDate |
jewishDate2 | JewishDate |
example:
const jewishDate1: JewishDate = {
day: 13,
monthName: "Elul",
year: 5781,
month: 13,
};
const jewishDate2: JewishDate = {
day: 14,
monthName: "Shevat",
year: 5781,
month: 5,
};
IsJewishDatesEqual(jewishDate1, jewishDate2);
IsJewishDatesEqual(jewishDate2, jewishDate2);
getJewishDay(dayjsDate: Dayjs
) ⇒ JewishDay
Takes a gregorian date and returns a JewishMonth object.
example:
const date = Dayjs(new Date(2022, 0, 27));
getJewishDay(date);
getJewishMonth(date: Date
) ⇒ JewishMonth
Takes a gregorian date and returns a JewishMonth object.
example:
getJewishMonth(new Date(2022, 0, 27));
getHolidays(isIsrael: boolean
) ⇒ string[]
Returns an array of jewish holiday dates corresponding with the isIsrael param.
example:
getHolidays(true);
getHolidays(false);
dontSelectHolidays([isIsrael: boolean
]) ⇒ (day: BasicJewishDay) => boolean
Returns a function which can be passed to the canSelect
prop, in order to prevent holidays (corresponding with isIsrael
param) selection. The returned function takes a BasicJewishDay
object, and returns false
if it's an holiday and true
otherwise.
Param | Type | Default |
---|
isIsrael | boolean | false |
example:
full example here
dontSelectShabat(day: BasicJewishDay
) ⇒ boolean
A function to be passed to the canSelect
prop, in order to prevent shabat selection. Takes a BasicJewishDay
object, and returns false
if it's an shabat and true
otherwise.
Param | Type |
---|
day | BasicJewishDay |
example:
full example here
dontSelectShabatAndHolidays([isIsrael: boolean
]) ⇒ (day: BasicJewishDay) => boolean
Returns a function to be passed to the "canSelect" prop. combines dontSelectHolidays
and dontSelectShabat
in order to prevent both - shabat and holidays selection. The returned function takes a BasicJewishDay
object, and returns false
if it's an shabat or holiday and true
otherwise.
Param | Type | Default |
---|
isIsrael | boolean | false |
example:
full example here
dontSelectOutOfRange(minDate: Date
| null
, maxDate: Date
| null
) ⇒ (day: BasicJewishDay) => boolean
Takes min date and max date and returns a function to be passed to the "canSelect" prop, in order to prevent selection out of the supplied range. The returned function takes a BasicJewishDay
object, and returns true
if it's within range (min date and max date included) and false
otherwise.
You can pass a date only for one of the params and null to the other. In this case, the selectable range will be up to max date or from min date.
Param | Type |
---|
minDate | Date | null |
maxDate | Date | null |
example:
full example here
addDates(date: BasicJewishDate
| Date
, numDays: number
) ⇒ Date
Takes a BasicJewishDate
object or a Date
, adds a date interval (numDays
) to the date and then returns the new date.
Param | Type |
---|
date | BasicJewishDate | Date |
numDays | number |
example:
const date = new Date(2022, 3, 17);
addDates(date, 3))
subtractDates(date: BasicJewishDate
| Date
, numDays: number
) ⇒ Date
Takes a BasicJewishDate
object or a Date
, subtracts a date interval (numDays
) from the date and then returns the new date.
Param | Type |
---|
date | BasicJewishDate | Date |
numDays | number |
example:
const basicJewishDate: BasicJewishDate = {
day: 13,
monthName: "Elul",
year: 5781,
};
subtractDates(basicJewishDate, 4))